package com.kuang.dao;

import com.kuang.pojo.SystemDept;
import org.springframework.stereotype.Repository;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

//部门dao
@Repository
public class DepartmentDao {

    //模拟数据库中的数据
    /**
     * 
     */
    private static Map<Integer, SystemDept> departments = null;
    static {
        departments = new HashMap<Integer, SystemDept> ();//创建用部门表
//
//        departments.put(101 , new Department(101,"教学部"));
//        departments.put(102 , new Department(102,"市场部"));
//        departments.put(103 , new Department(103,"教研部"));
//        departments.put(104 , new Department(104,"运营部"));
//        departments.put(105 , new Department(105,"后勤部"));

    }

    //获得 所有部门信息  Collection 集合类的父类
    public Collection<SystemDept> getDepartments(){
        return departments.values();
    }

    //通过id的到部门信息
    public SystemDept getDepartmentById(Integer id){
        return departments.get(id);  //返回一个部门实体
    }

}
